#include <iostream>
#include <signal.h>
#include <unistd.h>

//设置signal函数
void m_signalhander(int signum){
    std::cout << "Get a signal : " << signum << std::endl;
}

int main(){
    //兑换信号2，也就是Ctrl+C
    signal(SIGINT, m_signalhander);

    while(true){
        std::cout << "This is a Test" << std::endl;\
        sleep(1);
    }

    return 0;
}